package com.unknow.first.dapp.admin.account.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.unknow.first.dapp.admin.account.mapper.TSystemAddress;
import com.unknow.first.dapp.admin.account.mapper.TSystemAddressMapper;
import com.unknow.first.dapp.admin.account.service.TSystemAddressService;
@Service
public class TSystemAddressServiceImpl extends ServiceImpl<TSystemAddressMapper, TSystemAddress> implements TSystemAddressService{

    @Override
    public Map<Integer, List<TSystemAddress>> getSystemAddressMap() throws Exception {
        LambdaQueryWrapper<TSystemAddress> query = Wrappers.<TSystemAddress>lambdaQuery()
            .eq(TSystemAddress::getStatus, 10);
        List<TSystemAddress> activeSystemAddressList =  this.getBaseMapper().selectList(query);
        return activeSystemAddressList.stream().collect(Collectors.groupingBy(TSystemAddress::getAddressType));
    }
}
